package cz.via.wowss.entities;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/*
 * AH fuck it. V DB je player+company id jako primary key
 * Logicky je to sice blbost (muze byt vic transakci se stejnym
 * subjektem), ale stejne to nepouzivame
 */


@Entity
//@IdClass(TransactionPK.class)
@Table(name = "PLAYER_TRANSACTION")
public class PlayerTransaction {

	@Id
	@ManyToOne
	@JoinColumn(name = "PLAYER_ID", nullable = false)
	private Player player;

	@Id
	@ManyToOne
	@JoinColumn(name = "COMPANY_ID", nullable = false)
	private Company company;

	@Column(name = "STOCK_COUNT", nullable = false)
	private int stockCount;

	@Column(name = "PRICE_PER_STOCK", nullable = false)
	private BigDecimal pricePerStock;

	@Column(name = "DATE", nullable = false)
	private Date date;

	public Player getPlayer() {
		return player;
	}

	public void setPlayer(Player player) {
		this.player = player;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public int getStockCount() {
		return stockCount;
	}

	public void setStockCount(int stockCount) {
		this.stockCount = stockCount;
	}

	public BigDecimal getPricePerStock() {
		return pricePerStock;
	}

	public void setPricePerStock(BigDecimal pricePerStock) {
		this.pricePerStock = pricePerStock;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	
}
